import 'package:auto_route/auto_route.dart';
import 'package:convergence_media/features/circle/riverpod/video_catgory.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

@RoutePage()
class FollowScreen extends ConsumerWidget {
  const FollowScreen({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return const Placeholder();
    // return ExtendedNestedScrollView(
    //   headerSliverBuilder: (context, innerBoxIsScrolled) {
    //     return [
    //       const FollowList(),
    //     ];
    //   },
    //   body: Container(),
    // );
  }
}

class FollowList extends ConsumerWidget {
  const FollowList({
    super.key,
  });

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final asyncValue = ref.watch(videoCatgoryProvider);
    return asyncValue.when(
      data: (data) => SliverList.builder(
        itemBuilder: (context, index) {
          return Container(
            width: 76.w,
            height: 61.w,
            alignment: Alignment.center,
            child: Column(
              children: [
                CircleAvatar(
                  radius: 25,
                  backgroundImage: NetworkImage(
                    data[index],
                  ),
                ),
              ],
            ),
          );
        },
      ),
      error: (error, stackTrace) => SliverToBoxAdapter(
        child: Text(error.toString()),
      ),
      loading: () => const SliverToBoxAdapter(
        child: LinearProgressIndicator(),
      ),
    );
  }
}
